OPPS Concepts

Object Oriented Programming is a programming concept that works on the principle that objects are the most important part of your program. It allows users create the objects that they want and then create methods to handle those objects. Manipulating these objects to get results is the goal of Object Oriented Programming.Object Oriented Programming popularly known as OOPs, is used in a modern programming language like Java  

Core OOP's Concepts are
  • Class
  • Object
  • Abstraction
  • Encapsulation  
  • Polymorphism
  • Inheritance
  • Method
  • Message passing 
Class:- The class is group of similar entities. Its is only logical component and not a physical entity.For example class car, Its include all type of cars.

Object:- A object defined as instance of a class and there can be multiple instances of a class program.

Inheritance:- Inheritance is an OOPS concept in which one object acquires the properties and behaviors of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software. 

Polymorphism:- One task can performed in different ways.

Abstraction:- Abstraction is the concept of hiding the internal details and describing things in simple terms. For example, a method that adds two integers. The internal processing of the method is hidden from the outer world.For example, while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator, etc. 
Encapsulation:- It is technique used to implement abstraction in object-oriented programming. Encapsulation is used for access restriction to class members and methods.

Access modifier keywords are used for encapsulation in object oriented programming. For example, encapsulation in java is achieved using private, protected and public keywords.

Rules for Java Class
  • A class can have only public or default(no modifier) access specifier.
  • It can be either abstract, final or concrete (normal class).
  • It must have the class keyword, and class must be followed by a legal identifier.
  • It may optionally extend one parent class. By default, it will extend java.lang.Object.
  • It may optionally implement any number of comma-separated interfaces.
  • The class's variables and methods are declared within a set of curly braces {}.
  • Each .java source file may contain only one public class. A source file may contain any number of default visible classes.
  • Finally, the source file name must match the public class name and it must have a .java suffix.

No comments:

Post a Comment